package com.yogee.topseller.activity.tianyan;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yogee.core.http.listener.HttpOnNextListener;
import com.yogee.core.http.subscribers.BaseSubscriber;
import com.yogee.core.utils.ToastUtils;
import com.yogee.topseller.R;
import com.yogee.topseller.activity.base.HttpActivity;
import com.yogee.topseller.adapter.BzxrAdapter;
import com.yogee.topseller.bean.BzxrBean;
import com.yogee.topseller.bean.DetailBean;
import com.yogee.topseller.bean.ZqxxBean;
import com.yogee.topseller.http.HttpManager;
import com.yogee.topseller.layout.TitleLayout;
import com.yogee.topseller.utils.LogUtils;
import com.zly.widget.CollapsedTextView;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import butterknife.BindView;

public class ZqxxDetailActivity extends HttpActivity {

    @BindView(R.id.add_card_titlelayout)
    TitleLayout titlelayout;

    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.tv_value1)
    TextView tv_value1;
    @BindView(R.id.tv_value2)
    TextView tv_value2;
    @BindView(R.id.tv_value3)
    TextView tv_value3;
    @BindView(R.id.tv_value4)
    TextView tv_value4;
    @BindView(R.id.tv_value5)
    TextView tv_value5;
    @BindView(R.id.tv_value6)
    TextView tv_value6;
    @BindView(R.id.tv_value7)
    TextView tv_value7;
    @BindView(R.id.tv_value8)
    TextView tv_value8;
    @BindView(R.id.tv_value9)
    TextView tv_value9;
    @BindView(R.id.tv_value10)
    TextView tv_value10;
    @BindView(R.id.tv_value11)
    TextView tv_value11;
    @BindView(R.id.tv_value12)
    TextView tv_value12;
    @BindView(R.id.tv_value13)
    TextView tv_value13;
    @BindView(R.id.tv_value14)
    TextView tv_value14;
    @BindView(R.id.tv_value15)
    TextView tv_value15;
    @BindView(R.id.tv_value17)
    TextView tv_value17;
    @BindView(R.id.tv_value18)
    TextView tv_value18;
    @BindView(R.id.tv_value20)
    TextView tv_value20;
    @BindView(R.id.tv_value21)
    TextView tv_value21;
    @BindView(R.id.tv_value22)
    TextView tv_value22;
    @BindView(R.id.tv_value23)
    TextView tv_value23;
    @BindView(R.id.tv_value24)
    TextView tv_value24;
    @BindView(R.id.tv_value25)
    TextView tv_value25;
    @BindView(R.id.tv_value26)
    TextView tv_value26;
    @BindView(R.id.tv_value27)
    TextView tv_value27;
    @BindView(R.id.tv_value28)
    TextView tv_value28;

    @BindView(R.id.ll1)
    LinearLayout ll1;
    @BindView(R.id.ll2)
    LinearLayout ll2;
    @BindView(R.id.tv_detail1)
    CollapsedTextView tv_detail1;

    @BindView(R.id.tv_detail2)
    CollapsedTextView tv_detail2;


    ZqxxBean.Item bean;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_detail_zqxx;
    }

    @Override
    protected void initView() {
        titlelayout.setActivity(this);
        titlelayout.setTitle("债券信息");
        bean = (ZqxxBean.Item) getIntent().getSerializableExtra("detail");
        setData();
    }

    private void setData(){
        if(bean!=null){
            SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try{
                tv_title.setText(bean.getBondName());
                tv_value1.setText(bean.getBondNum());
                tv_value2.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getBondStopTime())))));
                tv_value3.setText(bean.getBondTimeLimit());
                tv_value4.setText(bean.getBondTradeTime());
                tv_value5.setText(bean.getBondType());
                tv_value6.setText(bean.getCalInterestType());
                tv_value7.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getCreateTime())))));
                tv_value8.setText(bean.getCreditRatingGov());
                tv_value9.setText(bean.getDebtRating());
                tv_value10.setText(bean.getEscrowAgent());
                tv_value11.setText("");
                tv_value12.setText(bean.getExeRightType());
                tv_value13.setText(bean.getFaceInterestRate());
                tv_value14.setText(bean.getFaceValue());
                tv_value15.setText(bean.getFlowRange());

                tv_value17.setText(bean.getInterestDiff());

                tv_value18.setText(bean.getIssuedPrice());

                tv_value20.setText(bean.getPayInterestHZ());

                tv_value21.setText(bean.getPlanIssuedQuantity());
                tv_value22.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getPublishExpireTime())))));
                tv_value23.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getPublishTime())))));
                tv_value24.setText(bean.getPublisherName());
                tv_value25.setText(bean.getRealIssuedQuantity());
                tv_value26.setText(bean.getRefInterestRate());
                tv_value27.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getStartCalInterestTime())))));
                tv_value28.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getUpdateTime())))));


                if(TextUtils.isEmpty(bean.getRemark())){
                    ll1.setVisibility(View.GONE);
                }else{
                    ll1.setVisibility(View.VISIBLE);
                    tv_detail1.setText(bean.getRemark());
                }
                if(TextUtils.isEmpty(bean.getTip())){
                    ll2.setVisibility(View.GONE);
                }else{
                    ll2.setVisibility(View.VISIBLE);
                    tv_detail2.setText(bean.getTip());
                }
            }catch(Exception e){
                LogUtils.e("error",e.toString());
            }


        }
    }

}
